package com.javasm.commons.aspects;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @remark:
 */
@Component
@Aspect
public class LogAspect {
    @Pointcut("execution(* com.javasm.*.service.impl.*.*(..))")
    public void spc(){}

    @Around("spc()")
    public Object doAround(ProceedingJoinPoint jp){
        Object result = null;
        try {
            System.out.println("前置通知");
            result= jp.proceed();
            System.out.println("返回通知");
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }finally {
            return result;
        }
    }

}
